snapshot: Don't cause invalid reads
authorBenjamin Otte <otte@redhat.com>
Thu, 5 Apr 2018 16:18:55 +0000 (18:18 +0200)
committerBenjamin Otte <otte@redhat.com>
Thu, 5 Apr 2018 16:41:34 +0000 (18:41 +0200)
commit47ea3a9452becc5b707617557ec03ceaeac87ada
tree0da8bf85c74736e7a357ecc7a519868802c98e1e
parent1792f3b21efbd8fe04cf49f2b1b9f731e8c191ca
snapshot: Don't cause invalid reads

1. Pass clip rectangles to gtk_snapshot_push_state() that point into
   the state array.
2. g_array_set_size(len+1) the state array
3. Make that function realloc() the state array.
4. The clip rectangle now points into invalid memory
5. Use the clip array

This patch fixes things by moving step 5 to before step 2.
gtk/gtksnapshot.c